<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.5"/>
<title>NDK Programmer&#39;s Guide: &lt;code&gt;ndk-depends&lt;/code&gt; Tool</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
  $(window).load(resizeHeight);
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">NDK Programmer&#39;s Guide
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.5 -->
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;"
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('md_4__additional__info__n_d_k-_d_e_p_e_n_d_s.html','');});
</script>
<div id="doc-content">
<div class="header">
  <div class="headertitle">
<div class="title"><code>ndk-depends</code> Tool </div>  </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><h2>Introduction</h2>
<p>The <code>ndk-depends</code> tool that comes with this Android NDK allows you to dump the ELF dependencies of a given ELF shared library or executable.</p>
<p>With the &ndash;print-java option, it can also be used to generate a Java source fragment to load your native library and its dependencies in the correct order (see example below).</p>
<p>Use '<code>ndk-depends --help</code>' for complete usage information.</p>
<p>This tool is designed to support:</p>
<ul>
<li>Either 32-bit or 64-bit ELF binaries.</li>
<li>Either little-endian or big-endian ELF binaries.</li>
<li>Unicode file paths, on Windows.</li>
</ul>
<p>Note: The Windows binary will NOT work with Cygwin paths !</p>
<h2>Examples</h2>
<ul>
<li><code>ndk-depends path/to/libfoo.so</code> Dump all dependencies of libfoo.so, in topological order, so that any library listed in the result appears before any other library it depends on.</li>
<li><code>ndk-depends --print-paths path/to/libfoo.so</code> Same as above, but also prints the path of the libraries on your host file system.</li>
<li><code>ndk-depends -L some/other/path path/to/libfoo.so</code> Append 'some/other/path' to the search path for depending libraries when looking at the dependencies for 'libfoo.so'</li>
<li><code>ndk-depends --print-direct path/to/libfoo.so</code> Only print the <em>direct</em> dependencies of libfoo.so, and nothing else, in the order they appear in the file.</li>
<li><code>ndk-depends path/to/libfoo.so --print-java</code> Prints a Java source fragment that corresponds to the load of 'libfoo' with System.loadLibrary(). This lists all libraries in reverse order, and ignores system libraries (e.g. libc.so).</li>
<li><code>ndk-depends path/to/libfoo.so --print-dot | dot -Tpng -o /tmp/graph.png</code> Prints the dependency graph as Graphviz .dot file, then generate a PNG image for it.</li>
<li><code>ndk-depends --help</code> Print complete usage details.</li>
</ul>
<p>Let's assume your project has the several libraries: </p>
<pre class="fragment">    libfoo.so -&gt; depends on libbar.so and libzoo.so
    libbar.so -&gt; depends on the system's liblog.so
    libzoo.so -&gt; depends on libbar.so
</pre><p>Then '<code>ndk-depends libs/armeabi/libfoo.so</code>' will typically print: </p>
<pre class="fragment">    libfoo.so
    libzoo.so
    libbar.so
    liblog.so
</pre><p>And '<code>ndk-depends --print-java libs/armeabi/libfoo.so</code>' will print: </p>
<pre class="fragment">    System.loadLibrary("bar");
    System.loadLibrary("zoo");
    System.loadLibrary("foo");
</pre><p>This is handy to avoid computing the reverse library order yourself for complex projects.</p>
<p>For more details, see the output of '<code>ndk-depends --help</code>'. </p>
</div></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="footer">Generated on Wed Jun 25 2014 00:51:19 for NDK Programmer&#39;s Guide by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.5 </li>
  </ul>
</div>
</body>
</html>
